﻿using System.Net.Sockets;
using System.Runtime.CompilerServices;

namespace eNets.CBK.Sockets;

public readonly ref struct SocketResult
{
    internal SocketResult(SocketArgs args)
    {
        this.args = args;
    }

    private readonly SocketArgs args;

    public int Count
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { return this.args.BytesTransferred; }
    }

    public SocketError Error
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { return this.args.SocketError; }
    }

    public object UserToken
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { return this.args.UserToken; }
    }

    public byte ValueToken
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { return this.args.ValueToken; }
    }

    public Socket AcceptSocket
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { return this.args.AcceptSocket; }
    }

    public Socket ConnectSocket
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get { return this.args.ConnectSocket; }
    }
}